/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DAOHibernate;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

/**
 *
 * @author Thais
 */
public class HibernateUtil {

    public final static SessionFactory sessionFacotry = buildSessionFactory();

    private static SessionFactory buildSessionFactory() {
        try {
            return new AnnotationConfiguration().configure().buildSessionFactory();
        } catch (Throwable e) {
            System.out.println(" Erro:" + e.getStackTrace());
            throw new ExceptionInInitializerError(e);
        }
    }

    public static SessionFactory getSessionfacotry() {
        return sessionFacotry;
    }
}
